﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using _02.ClassLibrary;//这是02.xxxxx的类库
using System.Reflection;

namespace _02.创建程序集
{
    class Program
    {
        static void Main(string[] args)
        {
            //思路：和书中的区别是，书想表达的csc原理去生产dll或者exe的东西然后再去调用
            //我现在的做法偏向于实际操作，1.实际新建一个dll类库，2.客户端using调用即可
            //用反编译的reflector去看这这个dll
            //// Assembly 02.ClassLibrary, Version 1.0.0.0 xxx的xxx版本
            //[assembly: AssemblyProduct("02.ClassLibrary")]类库项目名称
            //[assembly: AssemblyCopyright("Copyright \x00a9  2014")]权利所属
            //[assembly: AssemblyTitle("02.ClassLibrary")]名称
            //[assembly: AssemblyDescription("")]描述
            //[assembly: AssemblyConfiguration("")]配置
            //[assembly: AssemblyCompany("")]公司
            //[assembly: Guid("6651cd45-47e0-43da-82dd-f79f72604bbf")]Guid
            //[assembly: RuntimeCompatibility(WrapNonExceptionThrows=true)]运行时
            //[assembly: AssemblyTrademark("")]
            //[assembly: ComVisible(false)]
            //[assembly: AssemblyFileVersion("1.0.0.0")]文件版本号
            //[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.EnableEditAndContinue | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.Default)]
            //[assembly: CompilationRelaxations(8)]
            //点击下去可以看到
            //References：引用的其他程序集


            TestClass t = new TestClass(12);
            Console.WriteLine(t.GetId());
            RunDllFunction();
            Console.ReadKey();
        }
        static void  RunDllFunction()
        {
            TestClass t = (TestClass)Assembly.Load("02.ClassLibrary").CreateInstance("_02.ClassLibrary.TestClass");
            //引用的程序集：02.ClassLibrary     创建的实例：_02.ClassLibrary.TestClass
            t.MyID = 12138;
            Console.WriteLine(t.MyID);
        }
    }
}
